package com.easylinkin.linkappapi.common.constant;

/**
 * <p>
 *     汇师小学对外开放接口
 * </p>
 *
 * @author tongjie
 * @since 2021-1-12
 */
public class CommonConstant {

    /**
     * 会话超时时长 24小时
     */
    public static final int SESSION_TIME_DEFAULT = 60*60*24;

    /**
     * 会话超时时长 12小时
     */
    public static final int SESSION_TIME_TWELVE = 60*60*12;

    /**
     * 重庆设备定位
     */
    public static final String DEVICE_POSITIONING = "device_positioning";

    /**
     * 空调ADC   和  暖通空调
     */
    public static final String AIR_CONDITIONER = "air_conditioner";

    public static final String APPLICATION_YML = "application.yml";
    //    逻辑未删除
    public static final int NOT_DELETE = 1;
    //    逻辑已删除
    public static final int DELETED = 0;

    /**
     * 图片抓拍导出最大限制
     */
    public static final int MAX_IMAGE_LIMIT = 20;

  /**
   * AES加密key
   */
  public static String AesKey = "wwweasylinkincom";

  public enum ResultCode  {

        /**
         * 成功
         */
        SUCCESS("0", "操作成功"),

        /**
         * 参数有误
         */
        PARAM_ERROR("40000", "客户端请求数据有误"),

        /**
         * 系统异常
         */
        SYSTEM_ERROR("50000", "系统错误");

        /**
         * 返回码
         */
        private String code;
        /**
         * 返回消息
         */
        private String message;

        ResultCode(String code, String message) {
            this.code = code;
            this.message = message;
        }

        public String getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }


    }


    /**
     * 字符编码 20190826 add
     */
    public interface CharsetName {

        String UTF_8 = "UTF-8";
        String ISO_8859_1 = "ISO-8859-1";
    }

    /**
     * 国际化语言 zh中文 en英文
     */
    public interface Language {

        String ZH = "zh";
        String EN = "en";
    }


    /**
     * map的初始化大小为16
     */
    public static final int MAP_DEFAULT_INITIAL_CAPACITY = 16;

    /**
     * 0
     */
    public static final int ZERO = 0;
    /**
     * 1
     */
    public static final int ONE = 1;
    /**
     * 2
     */
    public static final int TWO = 2;
    /**
     * 3
     */
    public static final int THREE = 3;
    /**
     * 4
     */
    public static final int FOUR = 4;
    /**
     * 5
     */
    public static final int FIVE = 5;
    /**
     * 6
     */
    public static final int SIX = 6;
    /**
     * 7
     */
    public static final int SEVEN = 7;
    /**
     * 8
     */
    public static final int EIGHT = 8;
    /**
     * 10
     */
    public static final int TEN = 10;

    /**
     * 12
     */
    public static final int TWELVE = 12;


    /**
     * 99
     */
    public static final int NINETY_NINE = 99;
    /**
     * 字符串0
     */
    public static final String ZERO_STR = "0";

    /**
     * 斜杆字符串 /
     */
    public static final String DIAGONAL_BAR_STR = "/";

    /**
     * 冒号字符串 :
     */
    public static final String COLON_STR = ":";

    /**
     *车辆告警短信模板唯一编码
     */
    public static final String SMS_221055214 = "SMS_221055214";

    /***
     * 告警模板
     */
    public static final String SMS_190276412="SMS_190276412";

    /***
     * 分子产品注册模板
     */
    public static final String SMS_227010034="SMS_227010034";

    public static final String appTokenKeyPre = "spring:session:app_token:";

    /**
     * 平台枚举
     */
    public static enum Platform {
        /**
         * 房产装修状态
         */
        UNKNOWN_PLATFORM(0, "unknownPlatform"),
        ADMIN_PC(1, "adminPC"),
        PC(2, "pc"),
        app(3, "app"),
        ;
        private int type;
        private String name;

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        Platform(int type, String name) {
            this.type = type;
            this.name = name;
        }

        /**
         * 根据名称获取枚举
         *
         * @param name 名称
         * @return 枚举
         */
        public static Platform getByName(String name) {
            for (Platform c : Platform.values()) {
                if (c.getName().equals(name)) {
                    return c;
                }
            }
            return null;
        }

        /**
         * 根据值获取枚举
         *
         * @param type 值
         * @return 枚举
         */
        public static Platform getByType(int type) {
            for (Platform c : Platform.values()) {
                if (c.getType() == type) {
                    return c;
                }
            }
            return null;
        }
    }

  /**
   * 树形节点类型
   */
  public static enum TreeTypeEnum {
    /**
     * 房产装修状态
     */
    ROOT(0, "根节点"),
    COMPANY(1, "公司"),
    WORK_TYPE(2, "班组"),
    USER(3, "人员"),
    ;
    private int type;
    private String name;

    public int getType() {
      return type;
    }

    public String getName() {
      return name;
    }

    TreeTypeEnum(int type, String name) {
      this.type = type;
      this.name = name;
    }

    /**
     * 根据名称获取枚举
     *
     * @param name 名称
     * @return 枚举
     */
    public static TreeTypeEnum getByName(String name) {
      for (TreeTypeEnum c : TreeTypeEnum.values()) {
        if (c.getName().equals(name)) {
          return c;
        }
      }
      return null;
    }

    /**
     * 根据值获取枚举
     *
     * @param type 值
     * @return 枚举
     */
    public static TreeTypeEnum getByType(int type) {
      for (TreeTypeEnum c : TreeTypeEnum.values()) {
        if (c.getType() == type) {
          return c;
        }
      }
      return null;
    }
  }

}

